﻿using NHibernate.Validator.Engine;
using TestBat.IModels.Models;
using TestBat.Models.Exceptions;
using TestBat.ServiceLocator;

namespace TestBat.Models.Models
{
    public abstract class Model : IModel
    {
        protected void Validate(object entity)
        {
            var invalidValues = DefaultServiceLocator.Get<ValidatorEngine>().Validate(entity);
            if (invalidValues.Length != 0)
                throw new ValidationException(invalidValues);
        }

        //[Conversation(ConversationEndMode.End)]
        //public void EndConversation()
        //{
        //}

        //[Conversation(ConversationEndMode.Abort)]
        //public void AbortConversation()
        //{
        //}
    }
}
